/*
 * RTSException.h
 *
 *  Created on: Apr 22, 2013
 *      Author: travis
 *
 *	Exception class
 *
 *	Used for exception handling in OpenRTS engine. Object of this type
 *	is thrown when error appears. it contains information about object
 *	throwing error, string message with error specification and error
 *	type identification (based on ErrorMessage type). Error could be
 *	printed to standard error output with function print.
 */

#ifndef RTSEXCEPTION_H_
#define RTSEXCEPTION_H_

#include <iostream>
#include <exception>
#include "Message.h"

namespace Engine
{

class RTS_EXCEPTION : public std::exception
{
public:
	RTS_EXCEPTION(const std::string& sender, const std::string& msg, unsigned int errType)
	: sender(sender), msg(msg), errType(errType) {};

	virtual ~RTS_EXCEPTION() throw ();
	const virtual char* what() const throw ();

	// print error message on cerr
	void print();

	// get / set
	unsigned int getErrType();
protected:
	std::string sender, msg;
	unsigned int errType;
};

}

#endif /* RTSEXCEPTION_H_ */
